var e = getApp();

Page({
  data: {
    isvip:2,
    isShow: !1,
    is4s: 2,
    phone: '',
    is_valid:0,
    face_card:'',
    smit_card:''
  },
  onLoad: function(e) {
    var that= this
    console.log(that.data)
  },
  onShow: function() {

    var i = this;
    e.util.getUserInfo(function(e) {
      e.memberInfo ? (i.setData({
        memberInfo: e.memberInfo
      }), wx.setStorageSync("uid", e.memberInfo.uid), i.firstin(e.memberInfo)) : i.setData({
        isShow: !0
      });
    });
  },
  hideDialog: function() {
    this.setData({
      isShow: !this.data.isShow
    });
  },
  updateUserInfo: function(i) {
    var n = this;
    e.util.getUserInfo(function(e) {
      wx.setStorageSync("uid", e.memberInfo.uid), n.hideDialog(), n.firstin(e.memberInfo);
    }, i.detail);
  },
  firstin: function(i) {
    var n = this;
    console.log(i), e.util.request({
      url: "entry/wxapp/Api",
      data: {
        m: "monai_market",
        r: "me.detail",
        uid: i.uid,
        head_image: i.avatar,
        nickname: i.nickname
      },
      success: function(ee) {
     
        e.globalData.vip = ee.data.data.user.is_vip
        e.globalData.is_valid = ee.data.data.user.is_valid
        console.log('sdasdasdas',ee),
          // console.log(ee.data.data.user.phone),
        n.setData({
          detail: ee.data.data,
          is4s: ee.data.data.user,
          is_member: ee.data.data.user.is_member,
          store_img: ee.data.data.user.store_img,
          phone:ee.data.data.user.phone,
          isvip: ee.data.data.user.is_vip,
          is_valid : ee.data.data.user.is_valid,
          face_card: ee.data.data.user.face_card,
          smit_card: ee.data.data.user.smit_card
        });
        console.log('dafa',n.data)
      }
    });
    // setTimeout(function () {
    //   if (n.data.isvip == 2) {
    //     wx.showModal({
    //       content: "请先实名认证",
    //       cancelText: "返回",
    //       confirmText: "去认证",
    //       success: function (e) {
    //         console.log(e)
    //         if (e.confirm == true) {
    //           wx.navigateTo({
    //             url: '../smrz/smrz',
    //           })
    //         }
    //       }
    //     })
    //   }
    // }, 1000)
  },
  goset: function(ff) {
    console.log(ff)
    var dd = ff.detail.formId
    e.fomrid(dd);
    wx.navigateTo({
      url: "/pages/mine/info/index"
    });
  },
  gosett: function(ff) {
    console.log(ff)
    var dd = ff.detail.formId
    e.fomrid(dd);
  },
  retopublicity: function() {
    wx.navigateTo({
      url: "/pages/publicity/index"
    });
  },
  clbj: function(ff) {
    var dd = ff.detail.formId
    e.fomrid(dd);
    wx.navigateTo({
      url: "../clbj/clbj?tab=100"
    });
  },
  wddp: function(ff) {
    var dd = ff.detail.formId
    e.fomrid(dd);
    wx.navigateTo({
      url: "/pages/store/index"
    });
  },
  wdgz: function(ff) {
    var dd = ff.detail.formId
    e.fomrid(dd);
    wx.navigateTo({
      url: "/pages/fensi/fensi?type=2"
    });
  },
  gzwd: function(ff) {
    var dd = ff.detail.formId
    e.fomrid(dd);
    wx.navigateTo({
      url: "/pages/fensi/fensi?type=1"
    });
  },
  ckly: function(ff) {
    var dd = ff.detail.formId
    e.fomrid(dd);
    wx.navigateTo({
      url: "/pages/home/liuyan/liuyan"
    });
  },
  binding: function() {
    wx.navigateTo({
      url: "/pages/enter/enter"
    });
  },
  rz:function(){
    var t= this
    console.log(t.data.face_card)
    wx.navigateTo({
      url: "/pages/smrz/smrz?is_valid=" + t.data.is_valid + "&face_card=" + t.data.face_card + "&smit_card=" + t.data.smit_card
    });
  },
  retocollection: function() {
    wx.navigateTo({
      url: "/pages/collection/index"
    });
  },
  weizhang: function() {
    wx.navigateTo({
      url: "/pages/weizhang/weizhang"
    });
  },
  tuiguang: function() {
    wx.navigateTo({
      url: "/pages/mine/sale/index"
    });
  },
  mefabu: function() {
    wx.navigateTo({
      url: "/pages/salelist/index"
    });
  },
  goPartOrder: function() {
    wx.navigateTo({
      url: "/pages/part/apply/index"
    });
  },
  onReachBottom: function() {}
});